package com.groupseven.backend.controller;

import com.groupseven.backend.services.EchartsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/api/v1/echarts")
public class EchartsController {
    @Autowired
    private EchartsService echartsService;

//    @GetMapping("/result")
//    public Map<String,Integer> getEchartsDataOfAffiliationAndQuantity(){
//        return echartsService.getEchartsDataOfAffiliationAndQuantity();
//    }
    //机构成果总量图
    @GetMapping("/result")
    public Map<String, List<String>> getAffiliationAndQuantity(){
        return echartsService.getAffiliationAndQuantity();
    }
    //教师成果总量图
    @GetMapping("/result/teachers")
    public Map<String, List<String>> getTeachernameAndQuantity(){
        return echartsService.getTeachernaneAndQuantity();
    }
    //教师各等级成果总量图
    @GetMapping("/result/teachers/{TeacherName}")
    public Map<String, List<String>> getQuantityByTeacherName(@PathVariable String TeacherName){
        return echartsService.getTeacherQuantityAndLevel(TeacherName);
    }
    //机构各等级成果总量图
    @GetMapping("/result/level")
    public Map<String,Map<String,Map<String,Integer>>> test(){
        return echartsService.getEchartDataOfAffiliationAndQuantityAndLevel();
    }
}
